<template>
  <base-breadcrumb :title="$route.meta.title">
    <!-- 实测实量点位重构管理 -->
    <div id="base-breadcrumb" style="position: relative; overflow: hidden">
      <!-- 搜索 -->
      <searchData :searchData="searchArr" @search="search"></searchData>
      <!-- 表格 -->
      <a-card :bordered="false">
        <!-- <title-name :title="$route.meta.title"></title-name> -->
        <list-table
          ref="table"
          tableLayout="fixed"
          size="default"
          rowKey="projectId"
          :columns="columns"
          :request="loadData"
          :alert="true"
          show-size-changer
          show-quick-jumper
          showPagination="auto"
        >
          <span slot="action" slot-scope="text, record">
            <template>
              <a @click="handleManage(record)">查看项目点位</a>
            </template>
          </span>
        </list-table>
      </a-card>
    </div>
  </base-breadcrumb>
</template>

<script>
import { STable } from '@/components' // 表格
import { pointRefactor } from '@/api/quality/reality' // api
import SelectSubCompany from '@/components/Select/SelectSubCompany' // 分公司
import SelectProject from '@/components/Select/SelectProject' // 项目名称
const searchArr = [
  // 搜索框
  {
    name: '分公司',
    type: SelectSubCompany,
    valueKey: 'branchCompanyId',
  },
  // {
  //   name: '项目名称',
  //   type: SelectProject,
  //   valueKey: 'projectId',
  // },
]
const columns = [
  {
    title: '分公司',
    dataIndex: 'branchCompanyName',
  },
  {
    title: '项目名称',
    dataIndex: 'projectName',
  },
  {
    title: '重构点位数量',
    dataIndex: 'pointRefactorNumber',
  },
  {
    title: '新增点位数量',
    dataIndex: 'pointAddNumber',
  },
  {
    title: '操作',
    dataIndex: 'action',
    width: '350px',
    align: 'center',
    fixed: 'right',
    scopedSlots: { customRender: 'action' },
  },
]
export default {
  name:'a'+ Date.now(),
  components: {
    STable,
  },
  data() {
    this.columns = columns
    this.searchArr = searchArr
    return {
      // 查询参数
      queryParam: {},
      // 盒子高度
      boxHeight: 0,
      // 加载数据方法 必须为 Promise 对象
      loadData: (parameter) => {
        const requestParameters = Object.assign({}, parameter, this.queryParam)
        return pointRefactor.getList(requestParameters).then((res) => {
          return res
        })
      },
      form: {},
    }
  },
  methods: {
    // 搜索
    search(value) {
      if (value) this.queryParam = value
      this.$refs.table.refresh(true)
    },
    // 操作栏
    handleManage(e) {
      // let query = {
      //   form: e,
      //   editModel:0
      // }
      this.$router.push({
        name: '/quality/measuredAmount/pointListMaintenance',
        // query,
      })
    },
  },
}
</script>